length = int(input())
print(length)
nums = input()
nums = nums.split()
for index in range(len(nums)):
    nums[index] = int(nums[index])
    
    
x,y = input().split()
x,y = int(x),int(y)
print(x,y)

print(abs(nums.index(x)-nums.index(y)) == 1)

